<article id="wikiArticle">
<div></div>
<h2 id="Summary" name="Summary">总结</h2>
<p><code><strong>Promise</strong></code><strong><code>.prototype</code></strong> 属性表示 <a href="Reference/Global_Objects/Promise" title="Promise 对象用于表示一个异步操作的最终状态（完成或失败），以及其返回的值。"><code>Promise</code></a> 构造器的原型.</p>
<div><table class="standard-table">
<thead>
<tr>
<th class="header" colspan="2"><code>Promise.prototype</code> 属性的属性特性：</th>
</tr>
</thead>
<tbody>
<tr>
<td>writable</td>
<td>false</td>
</tr>
<tr>
<td>enumerable</td>
<td>false</td>
</tr>
<tr>
<td>configurable</td>
<td>false</td>
</tr>
</tbody>
</table></div>
<h2 id="Description" name="Description">描述</h2>
<p><a href="Reference/Global_Objects/Promise" title="Promise 对象用于表示一个异步操作的最终状态（完成或失败），以及其返回的值。"><code>Promise</code></a> 实例继承自 <a href="Reference/Global_Objects/Promise/prototype" title="Promise.prototype 属性表示 Promise 构造器的原型."><code>Promise.prototype</code></a>. 你可以在构造器的原型对象添加属性或方法到所有 <code>Promise</code> 实例上.</p>
<h2 id="属性">属性</h2>
<dl>
<dt><code>Promise.prototype.constructor</code></dt>
<dd>返回被创建的实例函数.  默认为 <a href="Reference/Global_Objects/Promise" title="Promise 对象用于表示一个异步操作的最终状态（完成或失败），以及其返回的值。"><code>Promise</code></a> 函数.</dd>
</dl>
<h2 id="方法">方法</h2>
<dl>
<dt><a href="Reference/Global_Objects/Promise/catch" title="catch() 方法返回一个Promise，并且处理拒绝的情况。它的行为与调用Promise.prototype.then(undefined, onRejected) 相同。 (事实上, calling obj.catch(onRejected) 内部calls obj.then(undefined, onRejected))."><code>Promise.prototype.catch(onRejected)</code></a></dt>
<dd>添加一个拒绝(rejection) 回调到当前 promise, 返回一个新的promise。当这个回调函数被调用，新 promise 将以它的返回值来resolve，否则如果当前promise 进入fulfilled状态，则以当前promise的完成结果作为新promise的完成结果.</dd>
<dt><a href="Reference/Global_Objects/Promise/then" title="then() 方法返回一个  Promise 。它最多需要有两个参数：Promise 的成功和失败情况的回调函数。"><code>Promise.prototype.then(onFulfilled, onRejected)</code></a></dt>
<dd>添加解决(fulfillment)和拒绝(rejection)回调到当前 promise, 返回一个新的 promise, 将以回调的返回值来resolve.</dd>
<dt><a href="Reference/Global_Objects/Promise/finally" title="返回一个设置了 finally 回调函数的Promise对象。"><code>Promise.prototype.finally(onFinally)</code></a></dt>
<dd>添加一个事件处理回调于当前promise对象，并且在原promise对象解析完毕后，返回一个新的promise对象。回调会在当前promise运行完毕后被调用，无论当前promise的状态是完成(fulfilled)还是失败(rejected)</dd>
</dl>
<h2 id="规范">规范</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
<tr>
<td><a class="external" href="https://www.ecma-international.org/ecma-262/6.0/#sec-promise.prototype" hreflang="en" lang="en" rel="noopener">ECMAScript 2015 (6th Edition, ECMA-262)<br/><small lang="zh-CN">Promise.prototype</small></a></td>
<td><span class="spec-Standard">Standard</span></td>
<td>Initial definition.</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容">浏览器兼容</h2>
<p></p><div class="blockIndicator warning"><strong><a class="external" href="https://github.com/mdn/browser-compat-data" rel="noopener">We're converting our compatibility data into a machine-readable JSON format</a></strong>.
            This compatibility table still uses the old format,
            because we haven't yet converted the data it contains.
            <strong><a class="new" href="/zh-CN/docs/MDN/Contribute/Structures/Compatibility_tables" rel="nofollow">Find out how you can help!</a></strong></div>
<div class="htab">
<a id="AutoCompatibilityTable" name="AutoCompatibilityTable"></a>
<ul>
<li class="selected"><a>Desktop</a></li>
<li><a>Mobile</a></li>
</ul>
</div><p></p>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari</th>
</tr>
<tr>
<td>Basic support</td>
<td>32</td>
<td><a href="/en-US/Firefox/Releases/24" title="Released on 2013-09-17.">24.0</a> (24.0) as <code>Future</code><br/>
<a href="/en-US/Firefox/Releases/25" title="Released on 2013-10-29.">25.0</a> (25.0) as <code>Promise</code> behind a flag[1]<br/>
<a href="/en-US/Firefox/Releases/29" title="Released on 2014-04-29.">29.0</a> (29.0) by default</td>
<td><span style="color: #f00;">未实现</span></td>
<td>19</td>
<td>7.1</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Mobile</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
<th>Chrome for Android</th>
</tr>
<tr>
<td>Basic support</td>
<td><span style="color: #f00;">未实现</span></td>
<td>24.0 (24.0) as <code>Future</code><br/>
    25.0 (25.0) as <code>Promise</code> behind a flag[1]<br/>
    29.0 (29.0) by default</td>
<td><span style="color: #f00;">未实现</span></td>
<td><span style="color: #f00;">未实现</span></td>
<td>iOS 8</td>
<td>32</td>
</tr>
</tbody>
</table>
</div>
<p>[1] Gecko 24 has an experimental implementation of <code>Promise</code>, under the initial name of <code>Future</code>. It got renamed to its final name in Gecko 25, but disabled by default behind the flag <code>dom.promise.enabled</code>. <a class="external" href="https://bugzilla.mozilla.org/show_bug.cgi?id=918806" rel="noopener">Bug 918806</a> enabled Promises by default in Gecko 29.</p>
<h2 id="另见">另见</h2>
<ul>
<li><a href="Reference/Global_Objects/Promise" title="Promise 对象用于表示一个异步操作的最终状态（完成或失败），以及其返回的值。"><code>Promise</code></a></li>
</ul>
</article>